Skip to content

Updated regex for slot_ibm to include optional -R\d+ segment.#6246

Merged
PraveenPenguin merged 5 commits into
avocado-framework:masterfrom
maramsmurthy:smaram_physical_port_regex_update
May 18, 2026
Merged

Updated regex for slot_ibm to include optional -R\d+ segment.#6246
PraveenPenguin merged 5 commits into
avocado-framework:masterfrom
maramsmurthy:smaram_physical_port_regex_update

Conversation

@maramsmurthy
Copy link
Copy Markdown
Contributor

@maramsmurthy maramsmurthy commented Nov 27, 2025

This allows matching both standard and extended slot formats: Standard: U50EE.001.WZS00TL-P3-C14
Extended: U50EE.001.WZS00TL-P3-C14-R1
Change ensures compatibility with newer hardware naming conventions that include resource identifiers after the slot number. Backward Compatibility:

Existing slot formats without -R remain fully supported. No impact on current parsing logic for standard slot names. Testing Impact:

Verified regex against both formats to ensure correct matching. Additional unit tests recommended for extended slot names to prevent regressions.

Summary by CodeRabbit

  • Bug Fixes
    • Improved PCI slot detection to support additional IBM hardware device code format variations with optional suffixes, enhancing compatibility with a broader range of systems.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 27, 2025

Walkthrough

A regex pattern in the get_slot_from_sysfs function of avocado/utils/pci.py was modified to extend IBM loc-code slot pattern matching. The pattern was updated to optionally accept a trailing "-R" suffix by adding a non-capturing optional group (?:-R\d+)? to the existing pattern. The modification preserves all existing matches while enabling matching of IBM loc-code strings with the additional suffix. The remainder of the control flow logic remains unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5-10 minutes

  • Verify the regex pattern correctly matches both with and without the "-R" suffix
  • Confirm backward compatibility with existing IBM loc-code strings that lack the suffix
  • Review the optional group syntax (?:-R\d+)? to ensure it captures the intended pattern

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: a regex update to accept an optional -R\d+ segment in the IBM slot pattern.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74b7379 and 9cc6d14.

📒 Files selected for processing (1)
  • avocado/utils/pci.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (43)
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: Linux with Python 3.13
  • GitHub Check: Linux with Python 3.9
  • GitHub Check: Linux with Python 3.11
  • GitHub Check: Linux with Python 3.10
  • GitHub Check: Linux with Python 3.12
  • GitHub Check: rpm-build:fedora-41-aarch64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-s390x
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-41-ppc64le
  • GitHub Check: Build Package (wheel/tarball) for Python 3.10
  • GitHub Check: Fedora selftests
  • GitHub Check: Version task ubi:8.8
  • GitHub Check: macOS with Python 3.11
  • GitHub Check: Windows with Python 3.13
  • GitHub Check: Version task debian:12.4
  • GitHub Check: Windows with Python 3.11
  • GitHub Check: Windows with Python 3.10
  • GitHub Check: Version task ubuntu:22.04
  • GitHub Check: Static checks
  • GitHub Check: Code Coverage (3.11)
🔇 Additional comments (1)
avocado/utils/pci.py (1)

203-205: Regex extension looks correct and backward‑compatible

The added optional non‑capturing group (?:-R\d+)? cleanly extends the IBM loc‑code pattern to cover the -R<digits> suffix while preserving all existing matches and group numbering (since it’s non‑capturing). Given the complexity of this regex and its importance, please ensure we also add/extend unit tests to cover examples like U50EE.001.WZS00TL-P3-C14-R1 (and still cover the legacy ...-P3-C14 case) so regressions are caught going forward.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mr-avocado mr-avocado Bot moved this to Review Requested in Default project Nov 27, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.31%. Comparing base (48854e8) to head (f560230).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6246   +/-   ##
=======================================
  Coverage   72.31%   72.31%           
=======================================
  Files         206      206           
  Lines       23258    23258           
=======================================
  Hits        16818    16818           
  Misses       6440     6440           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@clebergnu clebergnu requested a review from richtja December 4, 2025 13:53
Copy link
Copy Markdown
Collaborator

@PraveenPenguin PraveenPenguin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@clebergnu clebergnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maramsmurthy thanks for this contribution. Could you please:

  1. Put an (external) reference to the format of the extended version of the identifiers
  2. Add a test that matches both old and new (extended) versions

Thanks!

@maramsmurthy
Copy link
Copy Markdown
Contributor Author

@clebergnu Following is the output for both the formats of. physical slot

from avocado.utils import pci
pci.get_slot_from_sysfs("0153:70:00.0")
'U78CD.001.FZHAK92-P2-C3'
pci.get_slot_from_sysfs("05b4:90:00.0")
'U50EE.001.WZS0011-P3-C20-R1'

Update worked successfully without any issues

@maramsmurthy maramsmurthy force-pushed the smaram_physical_port_regex_update branch from 0c3f452 to 32943e3 Compare March 3, 2026 17:09
@maramsmurthy maramsmurthy force-pushed the smaram_physical_port_regex_update branch from 32943e3 to e874659 Compare April 27, 2026 17:44
This allows matching both standard and extended slot formats:
Standard: U50EE.001.WZS00TL-P3-C14
Extended: U50EE.001.WZS00TL-P3-C14-R1
Change ensures compatibility with newer hardware naming conventions
that include resource identifiers after the slot number.
Backward Compatibility:

Existing slot formats without -R remain fully supported.
No impact on current parsing logic for standard slot names.
Testing Impact:

Verified regex against both formats to ensure correct matching.
Additional unit tests recommended for extended slot names to prevent
regressions.

Signed-off-by: Maram Srimannarayana Murthy <msmurthy@linux.vnet.ibm.com>
Signed-off-by: Maram Srimannarayana Murthy <msmurthy@linux.vnet.ibm.com>
U78CC.001.FZHAK92-P2-C3 which is exisitng format
U50EE.001.WZS0011-P3-C20-R1 which is new format

We are maitatining both the formats as both formats are required.
Both are returning expected output without any issues.

Signed-off-by: Maram Srimannarayana Murthy <msmurthy@linux.vnet.ibm.com>
@maramsmurthy maramsmurthy force-pushed the smaram_physical_port_regex_update branch from e874659 to 916d4f5 Compare April 27, 2026 18:01
Fixed 'Unexpected indentation' error in ReadTheDocs build by properly
formatting the Examples section in reStructuredText format using
double colon (::) and proper indentation.

Error was:
/home/docs/.../avocado/utils/pci.py:docstring of avocado.utils.pci.get_slot_from_sysfs:10: ERROR: Unexpected indentation.

Signed-off-by: Maram Srimannarayana Murthy <msmurthy@linux.vnet.ibm.com>
@maramsmurthy
Copy link
Copy Markdown
Contributor Author

@clebergnu Can you please have a look at this and let me know if any changes are still required?

@maramsmurthy
Copy link
Copy Markdown
Contributor Author

@maramsmurthy thanks for this contribution. Could you please:

  1. Put an (external) reference to the format of the extended version of the identifiers
  2. Add a test that matches both old and new (extended) versions

Thanks!

@clebergnu Can you please have a look and let me know if any changes are still required?

@maramsmurthy maramsmurthy requested a review from clebergnu May 4, 2026 10:39
@Naresh-ibm
Copy link
Copy Markdown
Contributor

@clebergnu can you please review this and approve if no more review comments, as we need this changes to get incorporated into our testing through misc-tests.
early help is really appreciated

Copy link
Copy Markdown
Contributor

@Naresh-ibm Naresh-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maramsmurthy
Copy link
Copy Markdown
Contributor Author

@clebergnu I’d be grateful if you could review this PR when it’s convenient for you. Thank you for your time, and I’m happy to address any feedback.

@PraveenPenguin
Copy link
Copy Markdown
Collaborator

@clebergnu I’d be grateful if you could review this PR when it’s convenient for you. Thank you for your time, and I’m happy to address any feedback.

@clebergnu @richtja can you please review this PR and ublock us

@maramsmurthy
Copy link
Copy Markdown
Contributor Author

maramsmurthy commented May 14, 2026

@clebergnu or @richtja we need your help here, Can you please review and approve if no changes are required.

@PraveenPenguin PraveenPenguin merged commit f560230 into avocado-framework:master May 18, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Review Requested to Done 114 in Default project May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done 114

Development

Successfully merging this pull request may close these issues.

4 participants